Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

415
Views
Groovy Grails Hibernate : batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

I'm new in Hibernate and Groovy, i dont know why i got error id in this code. My Grails version is 2.1.1

Grails-app/Domain using Hibernate

class Deposit implements Validateable{

BigInteger **id**
BigDecimal amount
BigDecimal currentBalance

static mapping = {
    datasource 'test'
    table 'DEPOSIT'
    id column: "ID"
    amount column: "amount"
    currentBalance column: "currentBalance"

    version false
}

DepositContoller

def depositTrx(){
    def savedata = new Deposit()    
    savedata.id=3;
    savedata.amount=122223;
    savedata.currentBalance=1511122;
    savedata.save()
    redirect(uri: "/Deposit")
}

if I use id in grails-app/Domain, i got this error: batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

when I change grails-app/Domain: id become to ide or whatever, the code successfully save data to database, but page show me this error null id in Deposit entry (don't flush the Session after an exception occurs)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If you would like to be able to manually assign the id you can set the generator to assigned:

static mapping = {
    id generator: 'assigned', column: "ID"
    ...
}

http://docs.grails.org/3.1.1/ref/Database%20Mapping/id.html

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!